Skip to content

Issue 168: add grid to enum schema workflow#184

Merged
eviltester merged 2 commits into
masterfrom
168-enum-to-schema
Jun 10, 2026
Merged

Issue 168: add grid to enum schema workflow#184
eviltester merged 2 commits into
masterfrom
168-enum-to-schema

Conversation

@eviltester

Copy link
Copy Markdown
Owner

Summary

  • add a Test Data Grid to Enum Schema workflow that derives enum schema rows from the live grid
  • add a shared schema replacement API and numeric enum-cap dialog with truncation confirmation
  • document the workflow on the Docusaurus Data Grid Editable page and add coverage across unit, component, and browser tests

Testing

  • pnpm run verify:ui
  • pnpm run verify:local

Copilot AI review requested due to automatic review settings June 10, 2026 13:13
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@eviltester, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 42 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b610e034-a356-4ce2-85ff-d870052c3c26

📥 Commits

Reviewing files that changed from the base of the PR and between bde250a and 9efb5e7.

📒 Files selected for processing (31)
  • apps/web/src/stories/population-actions.stories.js
  • apps/web/src/stories/test-data-population-toolbar.stories.js
  • apps/web/src/tests/browser/app/abstractions/components/confirm-dialog.component.js
  • apps/web/src/tests/browser/app/abstractions/components/test-data-panel.component.js
  • apps/web/src/tests/browser/app/abstractions/components/text-input-dialog.component.js
  • apps/web/src/tests/browser/app/functional/test-data/grid-to-enum-schema.spec.js
  • docs-src/docs/040-test-data/015-data-grid-editable.md
  • packages/core-ui/js/gui_components/app/data-population-panel/data-population-panel-controller.js
  • packages/core-ui/js/gui_components/app/data-population-panel/data-population-panel-view.js
  • packages/core-ui/js/gui_components/app/data-population-panel/index.js
  • packages/core-ui/js/gui_components/app/population-actions/index.js
  • packages/core-ui/js/gui_components/app/population-actions/population-actions-controller.js
  • packages/core-ui/js/gui_components/app/population-actions/population-actions-view.js
  • packages/core-ui/js/gui_components/app/test-data-grid/controller/test-data-grid-controller.js
  • packages/core-ui/js/gui_components/app/test-data-grid/schema/grid-to-enum-schema.js
  • packages/core-ui/js/gui_components/app/test-data-population-toolbar/index.js
  • packages/core-ui/js/gui_components/app/test-data-population-toolbar/test-data-population-toolbar-controller.js
  • packages/core-ui/js/gui_components/app/test-data-population-toolbar/test-data-population-toolbar-view.js
  • packages/core-ui/js/gui_components/shared/modal-text-input.js
  • packages/core-ui/js/gui_components/shared/schema-definition/index.js
  • packages/core-ui/js/gui_components/shared/schema-definition/shared-schema-definition-controller.js
  • packages/core-ui/js/gui_components/shared/test-data/schema/shared-schema-editor-controller.js
  • packages/core-ui/src/tests/app/data-population-panel.test.js
  • packages/core-ui/src/tests/app/population-actions.test.js
  • packages/core-ui/src/tests/app/test-data-population-toolbar.test.js
  • packages/core-ui/src/tests/grid/controller/test-data-grid-controller.test.js
  • packages/core-ui/src/tests/grid/schema/grid-to-enum-schema.test.js
  • packages/core-ui/src/tests/shared/dialog-services.test.js
  • packages/core-ui/src/tests/shared/shared-schema-definition-view.test.js
  • packages/core-ui/src/tests/utils/modal-text-input.test.js
  • packages/core/js/data_generation/utils/enumParser.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 168-enum-to-schema

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23e1f02396

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces a Grid to Enum Schema workflow: clicking the new toolbar button scans the live grid, prompts for an enum-value cap, optionally confirms truncation, and replaces the schema definition with one enum row per column. It also adds a shared replaceRows API on the schema editor, extends modal-text-input with message/label/numeric-input support, and fixes enum round-tripping by introducing EnumParser.unescapeQuotedEnumValue.

  • Core logic (grid-to-enum-schema.js, test-data-grid-controller.js): two-phase scan, user prompt, and optional truncation confirm are wired correctly; the busy flag lives inside the try/finally block and the textInputDialogService is lazily cached and destroyed on teardown.
  • Enum round-trip: serialiseEnumSchemaValue quotes values containing commas/quotes/newlines; buildRuleSpecFromSchemaRow wraps the raw value field in enum(…) before any parsing, so extractAwdEnumValues always handles the result correctly.
  • Tests: unit tests and a new Playwright spec cover the happy path, truncation-confirm path, and busy-flag reset on status-service throw.

Confidence Score: 5/5

Safe to merge — all critical paths are correctly handled and covered by tests.

The new workflow is well-isolated, cleans up in a finally block, and delegates schema mutation through an existing validated API. The enum round-trip through buildRuleSpecFromSchemaRow and extractAwdEnumValues is correct for all serialised value shapes.

test-data-grid-controller.test.js contains a dead-code mount in one test; test-data-grid-controller.js performs an unnecessary row construction on the initial grid probe.

Important Files Changed

Filename Overview
packages/core-ui/js/gui_components/app/test-data-grid/schema/grid-to-enum-schema.js New module: scans a GenericDataTable, deduplicates values per column in first-seen order, serialises comma/quote-containing values with backslash escaping, and returns structured enum schema rows.
packages/core-ui/js/gui_components/app/test-data-grid/controller/test-data-grid-controller.js Adds generateEnumSchemaFromGrid async function with correct try/finally busy-flag handling, lazy textInputDialogService caching, and proper teardown.
packages/core/js/data_generation/utils/enumParser.js Adds unescapeQuotedEnumValue static helper applied in both simple-format and AWD-format parse paths for correct backslash-escape restoration.
packages/core-ui/js/gui_components/shared/test-data/schema/shared-schema-editor-controller.js Adds replaceRows: sets rows, clears tokens, revalidates, re-renders, syncs text, and refreshes mode view in a single atomic call.
packages/core-ui/js/gui_components/shared/modal-text-input.js Extends requestTextInput with message, label, inputType, min, max, step parameters; cleans up stale attributes before each invocation.
packages/core-ui/src/tests/grid/controller/test-data-grid-controller.test.js Adds three new tests covering the full flow, 256-cap capping, and busy-flag reset on throw. One test contains a dead-code control setup.
apps/web/src/tests/browser/app/functional/test-data/grid-to-enum-schema.spec.js New Playwright spec covering the happy path and truncation-confirm path end-to-end via the real app.

Sequence Diagram

sequenceDiagram
    participant User
    participant Button as Grid to Enum Schema Button
    participant Controller as TestDataGridController
    participant Grid as Main Grid
    participant TextInputDialog
    participant ConfirmDialog
    participant SchemaEditor

    User->>Button: click
    Button->>Controller: onGenerateSchemaFromGrid()
    Controller->>Controller: setGenerateSchemaBusy(true)
    Controller->>Grid: getGridAsGenericDataTable()
    Grid-->>Controller: dataTable
    Controller->>Controller: buildGridEnumSchemaSummary (initial probe)
    alt no usable columns
        Controller-->>User: status warning, return false
    else usable columns found
        Controller->>TextInputDialog: requestTextInput (limit prompt)
        User-->>TextInputDialog: enter limit or cancel
        TextInputDialog-->>Controller: limit string or null
        alt cancelled
            Controller-->>User: status warning, return false
        else limit entered
            Controller->>Controller: createEnumSchemaRowsFromGrid (with limit)
            alt truncation needed
                Controller->>ConfirmDialog: requestConfirm
                User-->>ConfirmDialog: confirm or cancel
                ConfirmDialog-->>Controller: boolean
            end
            Controller->>SchemaEditor: replaceSchemaRows(rows)
            SchemaEditor-->>Controller: validation result
            Controller-->>User: status success
        end
    end
    Controller->>Controller: setGenerateSchemaBusy(false) [finally]
Loading

Reviews (2): Last reviewed commit: "Address enum schema review feedback" | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Grid to Enum Schema” workflow to the Test Data panel, allowing users to scan the current editable grid and replace the schema definition with enum-only rows derived from visible column values. This fits into the existing test-data generation UX by providing a faster path from “example data in grid” → “reusable enum schema” with truncation confirmation and updated documentation/tests.

Changes:

  • Introduces grid scanning + enum-schema row derivation, with a numeric limit prompt and optional truncation confirmation.
  • Adds a shared schema replacement API (replaceRows) and wires it through the schema definition/editor components.
  • Expands unit/component/browser test coverage and documents the workflow in Docusaurus.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/core-ui/src/tests/utils/modal-text-input.test.js Adds coverage for optional message/label + numeric input configuration in the text input dialog.
packages/core-ui/src/tests/shared/shared-schema-definition-view.test.js Verifies schema row replacement rerenders and refreshes text-mode output.
packages/core-ui/src/tests/shared/dialog-services.test.js Updates dialog service test to cover message/label and numeric input attributes.
packages/core-ui/src/tests/grid/schema/grid-to-enum-schema.test.js Adds unit tests for enum-limit normalization and enum row creation from grid data.
packages/core-ui/src/tests/grid/controller/test-data-grid-controller.test.js Adds controller-level tests for “Grid to Enum Schema” flow, including truncation confirmation and 256 cap.
packages/core-ui/src/tests/app/test-data-population-toolbar.test.js Ensures toolbar renders and disables the new action appropriately and emits callbacks.
packages/core-ui/src/tests/app/population-actions.test.js Ensures new action button + help affordance renders and emits clicks; covers busy state.
packages/core-ui/src/tests/app/data-population-panel.test.js Wires new callback through panel and validates schema replacement delegation.
packages/core-ui/js/gui_components/shared/test-data/schema/shared-schema-editor-controller.js Adds replaceRows implementation to reset/validate/rerender/sync when replacing schema rows.
packages/core-ui/js/gui_components/shared/schema-definition/shared-schema-definition-controller.js Exposes replaceRows on the schema definition controller.
packages/core-ui/js/gui_components/shared/schema-definition/index.js Exposes replaceRows on the schema definition component API.
packages/core-ui/js/gui_components/shared/modal-text-input.js Extends text input modal to support optional message/label and numeric field configuration.
packages/core-ui/js/gui_components/app/test-data-population-toolbar/test-data-population-toolbar-view.js Adds UI wiring/props for the new action + help text and busy flag propagation.
packages/core-ui/js/gui_components/app/test-data-population-toolbar/test-data-population-toolbar-controller.js Tracks generateSchemaBusy state for the toolbar.
packages/core-ui/js/gui_components/app/test-data-population-toolbar/index.js Adds setGenerateSchemaBusy component API for the toolbar.
packages/core-ui/js/gui_components/app/test-data-grid/schema/grid-to-enum-schema.js New implementation to summarize unique grid values and generate enum schema rows.
packages/core-ui/js/gui_components/app/test-data-grid/controller/test-data-grid-controller.js Adds the controller workflow to prompt for limit, confirm truncation, and replace schema rows.
packages/core-ui/js/gui_components/app/population-actions/population-actions-view.js Renders the new action button + help, wires click handler, and applies busy state.
packages/core-ui/js/gui_components/app/population-actions/population-actions-controller.js Adds state + callback handler for “Grid to Enum Schema”.
packages/core-ui/js/gui_components/app/population-actions/index.js Adds setGenerateSchemaBusy component API for population actions.
packages/core-ui/js/gui_components/app/data-population-panel/index.js Adds panel API for setGenerateSchemaBusy and replaceSchemaRows.
packages/core-ui/js/gui_components/app/data-population-panel/data-population-panel-view.js Passes new callback and busy flag down into the toolbar/actions.
packages/core-ui/js/gui_components/app/data-population-panel/data-population-panel-controller.js Tracks generateSchemaBusy state for the panel.
docs-src/docs/040-test-data/015-data-grid-editable.md Documents the new “Grid to Enum Schema” workflow and behavior.
apps/web/src/tests/browser/app/functional/test-data/grid-to-enum-schema.spec.js Adds Playwright functional coverage for schema creation and truncation confirmation.
apps/web/src/tests/browser/app/abstractions/components/text-input-dialog.component.js Updates page object to work with non-textbox inputs and customizable submit button label.
apps/web/src/tests/browser/app/abstractions/components/test-data-panel.component.js Adds page-object APIs to open/submit the new dialog; wires confirm/text-input components.
apps/web/src/tests/browser/app/abstractions/components/confirm-dialog.component.js Allows specifying confirm button label (needed for truncation confirm).
apps/web/src/stories/test-data-population-toolbar.stories.js Updates Storybook to include the new action and busy prop.
apps/web/src/stories/population-actions.stories.js Updates Storybook to show the new action and event wiring.

Comment thread packages/core-ui/js/gui_components/shared/modal-text-input.js Outdated
Comment thread docs-src/docs/040-test-data/015-data-grid-editable.md Outdated
@eviltester eviltester merged commit da8841f into master Jun 10, 2026
14 checks passed
@eviltester eviltester deleted the 168-enum-to-schema branch June 10, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants